Add comprehensive test suite following TDD guidelines without mocks#30
Merged
benomahony merged 14 commits intomainfrom Feb 2, 2026
Merged
Add comprehensive test suite following TDD guidelines without mocks#30benomahony merged 14 commits intomainfrom
benomahony merged 14 commits intomainfrom
Conversation
This commit adds a complete testing infrastructure for uv.nvim: Test Infrastructure: - Makefile with test targets (test, test-standalone, test-plenary) - Minimal init.lua for isolated test environment - Custom standalone test runner requiring no external dependencies - Plenary.nvim compatible tests for users who prefer that framework New Utils Module (lua/uv/utils.lua): - Pure functions extracted for testability - Code parsing: extract_imports, extract_globals, extract_functions - Code analysis: is_all_indented, analyze_code, extract_function_name - Config utilities: validate_config, merge_configs - Selection helpers: extract_selection, wrap_indented_code - Environment helpers: is_venv_path, build_run_command Test Coverage: - Configuration tests (defaults, merging, custom options) - Code parsing tests (imports, globals, functions, expressions) - Selection processing tests (indented code, expressions, functions) - Virtual environment tests (activation, auto-activation, PATH) - Integration tests (setup, commands, global exposure) - Buffer operations tests (real Neovim buffer interactions) - File operations tests (temp file creation) Run tests with: make test (standalone) or make test-plenary https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- CI runs on push to main and all pull requests - Tests on multiple Neovim versions (0.9.5, 0.10.0, stable, nightly) - Runs standalone tests (no external dependencies required) - Adds stylua linting step for code formatting checks - Adds stylua.toml configuration file https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Change "mock project structure" to "test project structure" since we're creating real directories, not using mocks. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Update stylua.toml to use 4-space indentation and convert all Lua files from tabs to spaces for consistency. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
The main branch uses tabs, so reverting stylua.toml and all Lua files to use tabs for consistency. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Normalize all indentation to use tabs consistently. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Collapse long assert_true call in remove_package_spec.lua - Expand long error() call in auto_activate_venv_spec.lua https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Removed: - lua/uv/utils.lua (not used by plugin, only tests) - tests/plenary/ (duplicate of standalone tests) - tests/standalone/test_*.lua individual files (duplicated in test_all.lua) - tests/fixtures/ (unused) - tests/run_tests.lua (unnecessary wrapper) Simplified: - test_all.lua now directly tests plugin API (~280 lines) - Makefile reduced to essentials Result: ~2900 lines removed, focused tests remain. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Remove the over-engineered standalone runner in favor of a simple self-contained test file following the existing pattern in the codebase. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Replace custom assert helpers with Lua's built-in assert() - Remove Makefile that didn't exist before https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
9e45cd6 to
4aa94a5
Compare
Remove custom it() wrapper and counters. Just run assertions directly. https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Convert all test files to use plenary's describe/it/assert - Update minimal_init.lua to clone plenary if needed - Update CI to use PlenaryBustedDirectory https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Remove duplicate is_venv_active test (already in statusline_spec) - Remove low-value "exports expected functions" test - Remove "is exported as a function" test from remove_package - Better organize describe blocks https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a complete testing infrastructure for uv.nvim:
Test Infrastructure:
New Utils Module (lua/uv/utils.lua):
Test Coverage:
Run tests with: make test (standalone) or make test-plenary
https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK